home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / osmoke.c < prev    next >
C/C++ Source or Header  |  1979-12-31  |  1KB  |  72 lines

  1. /* --------------------------------- osmoke.c ------------------------------- */
  2.  
  3. /* This is part of the flight simulator 'fly8'.
  4.  * Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5. */
  6.  
  7. /* object: smoke speck.
  8. */
  9.  
  10. #include "fly.h"
  11.  
  12.  
  13. static SHAPE shape_smoke = {
  14.     0,
  15.     0,
  16.     0,
  17.     1L,        /* weight */
  18.     0        /* drag */
  19. };
  20.  
  21. LOCAL_FUNC int FAR
  22. create_smoke (OBJECT *p)
  23. {
  24.     if (!st.owner)
  25.         return (1);
  26.  
  27.     p->color = CC_LGRAY;
  28.     p->time = 5*TIMEPSEC;
  29.     p->flags |= F_VISIBLE|F_DONE;
  30.  
  31.     LVcopy (p->R, st.owner->R);
  32.     Vcopy (p->a, st.owner->a);
  33.     Mcopy (p->T, st.owner->T);
  34.         p->speed = p->V[Z] = 10*VONE;
  35.  
  36.         return (0);
  37. }
  38.  
  39. #define DVSMOKE        1*VONE
  40. #define DASMOKE        (D90/10)
  41.  
  42. LOCAL_FUNC void FAR
  43. dynamics_smoke (OBJECT *p, int interval)
  44. {
  45.     p->V[X] += Frand()%(DVSMOKE+1) - DVSMOKE/2;
  46.     p->V[Y] += Frand()%(DVSMOKE+1) - DVSMOKE/2;
  47.     p->V[Z] += Frand()%(DVSMOKE+1) - DVSMOKE/2;
  48.     p->speed = ihypot3d (p->V);
  49.     p->a[X] += Frand()%(DASMOKE+1) - DASMOKE/2;
  50.     p->a[Y] += Frand()%(DASMOKE+1) - DASMOKE/2;
  51.     p->a[Z] += Frand()%(DASMOKE+1) - DASMOKE/2;
  52.     Mobj (p);
  53.  
  54.     object_update (p, interval);
  55. }
  56.  
  57. #undef DVSMOKE
  58. #undef DASMOKE
  59.  
  60. BODY FAR BoSmoke = {
  61.     0,
  62.     0,
  63.     "SMOKE",
  64.     &shape_smoke,
  65.     gen_read,
  66.     gen_term,
  67.     create_smoke,
  68.     gen_delete,
  69.     dynamics_smoke,
  70.     gen_hit
  71. };
  72.